<?php
require_once 'Zend/Validate/Abstract.php';
class Application_Form_Request extends Zend_Form {

    public function init() {
	
	// Mapping keys to db columns
	$db_mapping = array(
	    "descr" => "description",
	    "request" => "request",
	    "date_from" => "date_from",
	    "date_to" => "date_from",
	    "event_type" => "idevent_type"
	);
	
	// 
	
	$this->addElement('textarea', $db_mapping['descr'], array(
	    'label' => 'Beschreibung des Termins:',
	    'required' => true,
	    'filters' => array('StringTrim'),
	    'validators' => array("NotEmpty"),
	));

	$this->addElement('text', $db_mapping['date_from'], array(
	    'label' => 'Startdatum: ',
	    'required' => true,
	    'filters' => array('StringTrim'),
	    'validators' => array(
		new Zend_Validate_Date(array("format" => "dd.mm.yyyy"))
	    )
	));

	$this->addElement('text', $db_mapping['date_to'], array(
	    'label' => 'Enddatum: ',
	    'required' => true,
	    'filters' => array('StringTrim'),
	    'validators' => array(
		new Zend_Validate_Date(array("format" => "dd.mm.yyyy"))
	    )
	));

	$this->addElement('text', 'time_from', array(
	    'label' => 'Startzeit: ',
	    'required' => true,
	    'filters' => array('StringTrim'),
	    'validators' => array(
		new Zend_Validate_Date(array("format" => "H:i:s"))
	    )
	));

	$this->addElement('text', 'time_to', array(
	    'label' => 'Endzeit: ',
	    'required' => true,
	    'filters' => array('StringTrim'),
	    'validators' => array(
		new Zend_Validate_Date(array("format" => "H:i:s"))
	    )
	));

	$event_type = new Zend_Form_Element_Select('dropdown');
	$event_type->setLabel('Kategorie')->setRequired(true);
	$event_type->addMultiOptions(array(
	    "" => "Termin Typ auswaehlen",
	    "1" => "Eingewoehnungstermin" , 
	    "2" => "Fester Termin" ,
	    "3" => "Einzeltermin" ,
	    "4" => "abgesagte Termin" ,
	    "5" => " Gespaechtermin" , 
	    "6" => "Konferenz",
	    "7" => "Feste/Veranstaltungen" ,
	    "8" => "sonstiges"));
	$this->addElement($event_type);
	
	
 
	
	
	$this->addElement('submit', 'submit', array(
	    'label' => 'Antrag abspeichern: ')
	);
	
    }   
}


 
